package com.purang.web.bean;

public class SecurityPermissionFactory {

    private static final SecurityPermission ADMIN = new SecurityPermission("admin.*");

    private static final SecurityPermission READ = new SecurityPermission("admin.read.*");

    private static final SecurityPermission WRITE = new SecurityPermission("admin.write.*");

    private static final SecurityPermission DELETE = new SecurityPermission("admin.delete.*");

    private SecurityPermissionFactory() {
    }

    public static SecurityPermission getSecurityPermission(String flag) {
        if("admin".equals(flag)) {
            return ADMIN;
        } else if("read".equals(flag)) {
            return READ;
        } else if("write".equals(flag)) {
            return WRITE;
        } else if("delete".equals(flag)) {
            return DELETE;
        }
        return null;
    }

}
